package com.trsj.lnsj.common;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Paging<E> implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3759394364683745547L;

	private int number = 0;
	private int size = 0;
	private int totalElements = 0;
	private List<E> content = new ArrayList<E>();
	private String sort;
	private int numberOfElements;

	public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getTotalElements() {
        return totalElements;
    }

    public void setTotalElements(int totalElements) {
        this.totalElements = totalElements;
    }

    public List<E> getContent() {
        return content;
    }

    public void setContent(List<E> content) {
        this.content = content;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public int getNumberOfElements() {
        return numberOfElements;
    }

    public void setNumberOfElements(int numberOfElements) {
        this.numberOfElements = numberOfElements;
    }

    public int getStartIndex() {
		if (number <= 1) {
			return 0;
		}
		return (number-1)*size;
	}

	public int getTotalPage() {

		return (int) Math.ceil(Double.valueOf(totalElements)
				/ Double.valueOf(size));
	}

}
